package com.jdz.gxq.info.admin.employmentneed.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.jdz.gxq.info.admin.employmentneed.bo.Employmentneed;
import com.jdz.gxq.info.admin.employmentneed.form.EditEmploymentneedForm;
import com.jdz.gxq.info.admin.employmentneed.service.EmploymentneedService;
import com.jdz.gxq.info.common.action.CommonAction;

public class SaveEmploymentneedAction extends CommonAction {

	private EmploymentneedService employmentneedService = null;

	public ActionForward doExecute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws java.lang.Exception {

		EditEmploymentneedForm editEmploymentneedForm = (EditEmploymentneedForm) form;

		Employmentneed employmentneed = editEmploymentneedForm
				.getEmploymentneed();

		// // employmentneed名重复验证(其他后台逻辑验证也类似处理)
		// if (!employmentneedService.checkEmploymentneedName(employmentneed,
		// 2)) {
		// ActionMessages messages = new ActionMessages();
		// messages.add("employmentneed.needTime", new
		// ActionMessage("error.employmentneedNameExisted"));
		// addErrors(request, messages);
		// return mapping.getInputForward();
		// }

		employmentneed.setModifiedBy(getUserId(request));

		employmentneedService.updateEmploymentneed(employmentneed);

		return mapping.findForward("success");
	}

	public void setEmploymentneedService(
			EmploymentneedService employmentneedService) {
		this.employmentneedService = employmentneedService;
	}
}
